/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package phd.dupenois.changeidentifiers.base.intrinsic;

import phd.dupenois.changeidentifiers.ChangeIdentifier;
import phd.dupenois.changeidentifiers.dotpatterns.DotPattern;
import phd.dupenois.changeidentifiers.footprints.Footprint;
import phd.dupenois.changeidentifiers.utils.PropertiesTool;
import uk.co.dupenois.geometry.Line;

/**
 *
 * @author Max
 */
public class Orientation extends ChangeIdentifier{

    @Override
    public double calculateChange(Footprint previousFootprint, 
                            DotPattern previousChangeCausingDotPattern, 
                            DotPattern dotPattern) throws Exception {
        Line currentLine = PropertiesTool.getLineOfBestFit(dotPattern);
        Line previousLine = PropertiesTool.getLineOfBestFit(previousChangeCausingDotPattern);
        double currentAngle = currentLine.getAngleFromX();
        double previousAngle = previousLine.getAngleFromX();
        double change = Math.abs(currentAngle-previousAngle)/previousAngle;
        return change;
    }
    
}
